How signals and binary logic form the foundation of every digital device.
🌍 Signals in Daily Life
Communication using signals is something we do every day — and computers work the same way.
eg Railway guard uses green flag → train may leave
eg Car door warning light → ON if any door is not closed
eg Bank safe requires BOTH manager keys simultaneously
eg Seatbelt reminder → alert until front passenger buckles up
1HIGH — switch closed · bulb ON · voltage high · TRUE
0LOW — switch open · bulb OFF · voltage low · FALSE
key Computers process billions of 0s and 1s every second
key The CPU is built from billions of tiny logic gates
🔷 What is a Logic Gate?
A logic gate is an electronic circuit that accepts one or more binary inputs (0 or 1)
and produces a single binary output based on a specific logical rule.
Its internal circuit consists of transistors, diodes and resistors.
The CPU is made up of a collection of a large number of logic gates.
💡 Logic circuits enable certain logical conditions to be built using binary values,
allowing decisions to be made — just like real-world signal systems.
Basic Logic Gates
AND ALL inputs must be 1 for output to be 1
OR At least ONE input = 1 → output is 1
NOT Inverts the input: 0 becomes 1, 1 becomes 0
Combinational Logic Gates
NOR NOT + OR: output 1 only when ALL inputs are 0
NAND NOT + AND: output 0 only when ALL inputs are 1
★ NAND and NOR are called Universal Gates
📊 At-a-Glance: All Five Gates
Gate
Type
Expression
Output = 1 when…
Output = 0 when…
AND
Basic
Q = A·B
ALL inputs = 1
ANY input = 0
OR
Basic
Q = A+B
ANY input = 1
ALL inputs = 0
NOT
Basic
Q = A'
Input = 0
Input = 1
NOR
Combinational
Q = (A+B)'
ALL inputs = 0
ANY input = 1
NAND
Combinational
Q = (A·B)'
ANY input = 0
ALL inputs = 1
⚡ Basic Logic Gates
AND, OR and NOT — the three fundamental building blocks of all digital circuits.
AND
AND Gate
Output is 1 ONLY when ALL inputs are 1. Like switches in series.
Q = A · B
OR
OR Gate
Output is 1 when AT LEAST ONE input is 1. Like switches in parallel.
Q = A + B
NOT
NOT Gate (Inverter)
Output is ALWAYS opposite of input. Only one input; bubble = inversion.
Q = A'
AND Gate — Detail
GATE SYMBOL
DAY-TO-DAY EXAMPLES
1 Bank safe — needs BOTH manager keys at same time
2 Series circuit — two switches both closed → bulb ON
3 Computer lab — key-lock AND padlock both required
TRUTH TABLE — 2² = 4 states
A
B
Q = A·B
0
0
0
0
1
0
1
0
0
1
1
1
Rule: Output is 1 ONLY when ALL inputs are 1.
For 3 inputs: Q = A·B·C → truth table has 2³ = 8 rows.
OR Gate — Detail
GATE SYMBOL
DAY-TO-DAY EXAMPLES
1 Two-door bus — exit via front door OR back door
2 Parallel circuit — either switch closed → bulb ON
3 Multiple routes — Road A OR Road B — any one works
TRUTH TABLE — 2² = 4 states
A
B
Q = A+B
0
0
0
0
1
1
1
0
1
1
1
1
Rule: Output is 0 ONLY when ALL inputs are 0.
For 3 inputs: Q = A+B+C → output 0 only when all three = 0.
NOT Gate — Detail (Inverter)
GATE SYMBOL
DAY-TO-DAY EXAMPLES
1 Night sensor — bright (1) → light OFF (0); dark (0) → light ON (1)
2 Toggle switch — each press flips the state (YES ↔ NO)
3 NOT circuit — closed switch diverts current → bulb OFF
TRUTH TABLE — 2¹ = 2 states
A
Q = A'
0
1
1
0
Key facts:
— Only ONE input (no B). Output always opposite.
— The small circle (bubble ○) at the output = inversion symbol.
— Also called a Complement gate.
🔗 Combinational Logic Gates
NOR and NAND — formed by combining basic gates, and powerful enough to build any circuit on their own.
NOR
NOR Gate (NOT + OR)
Output is 1 ONLY when ALL inputs are 0. The exact opposite of OR.
Q = (A+B)'
NAND
NAND Gate (NOT + AND)
Output is 0 ONLY when ALL inputs are 1. The exact opposite of AND.
Q = (A·B)'
NOR Gate — Detail
🔗 Construction: OR gate output fed into a NOT gate input.
The bubble (○) at the output represents NOT. Equivalent to OR and NOT in series.
GATE SYMBOL
DAY-TO-DAY EXAMPLES
1 All-clear lamp — green light ON only when ALL sensors = 0
2 Quiet room indicator — ON only when no sound AND no motion
TRUTH TABLE — Step by Step
A
B
A+B
Q=(A+B)'
0
0
0
1
0
1
1
0
1
0
1
0
1
1
1
0
⭐ NOR is a Universal Gate — any Boolean circuit in the world can be built using only NOR gates.
NAND Gate — Detail
🔗 Construction: AND gate output fed into a NOT gate input.
The bubble (○) at the output represents NOT. Equivalent to AND and NOT in series.
GATE SYMBOL
DAY-TO-DAY EXAMPLES
1 Warning light — stays ON unless BOTH sensors are critical
2 Special lock — LOCKED only when both keys inserted
TRUTH TABLE — Step by Step
A
B
A·B
Q=(A·B)'
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
⭐ NAND is a Universal Gate — any Boolean circuit in the world can be built using only NAND gates.
🏆 How Universal Gates Replace All Others
USING NAND ONLY
NOT Connect both inputs together → NAND acts as NOT
AND NAND + NOT (invert the NAND output)
OR Three NAND gates combined with De Morgan's law
USING NOR ONLY
NOT Connect both inputs together → NOR acts as NOT
OR NOR + NOT (invert the NOR output)
AND Three NOR gates combined with De Morgan's law
📐 Designing Logic Circuits from Boolean Expressions
Step-by-step method to convert any Boolean expression into a working gate circuit.
📋 Step-by-Step Method
1 Identify all input variables (A, B, C …) and count them
2 Break the expression using operator precedence: NOT first → AND next → OR last
3 Draw each sub-expression as a gate, working left-to-right (inputs → output)
4 Connect the output of each sub-circuit to the input of the next gate
5 Label the final output Q and verify with a truth table
📏 Number of Truth Table Rows
Rows = 2ⁿ where n = number of input variables
Inputs (n)
Rows (2ⁿ)
Example
1
2
NOT gate
2
4
AND, OR, NAND, NOR
3
8
(A+B)·C
4
16
(A+B)·(C+D)
5
32
Complex circuits
✏️ Operator Precedence
1stNOT ( ' or ! ) — evaluate first, innermost first
2ndAND ( · or * ) — like multiplication in algebra
3rdOR ( + ) — like addition; evaluated last
( )Brackets always override the order above
🔍 Worked Examples
EXAMPLE 1: Q = A·B + C
Step 1 Inputs: A, B, C (n=3 → 8 rows)
Step 2 No NOT gates needed here
Step 3→ Gate 1: AND(A, B) → call result X
Step 4→ Gate 2: OR(X, C) → output Q
EXAMPLE 2: Q = (A+B)·A'
Step 1 Inputs: A, B (n=2 → 4 rows)
Step 2→ Gate 1: NOT(A) → call result Ā
Step 3→ Gate 2: OR(A, B) → call result X
Step 4→ Gate 3: AND(X, Ā) → output Q
⚡ Boolean Notation Reference
Operation
Symbols Used
Example
Gate
AND
· * (implicit AB)
A·B, A*B, AB
AND gate
OR
+
A+B
OR gate
NOT
! ~ ' overbar
!A, A', Ā
NOT gate
NAND
(A·B)'
!(A·B)
NAND gate
NOR
(A+B)'
!(A+B)
NOR gate
🖥️ Interactive Simulator
Type any Boolean expression to generate a live circuit diagram, or test individual gates with real-time signal flow.
Green wire = signal 1 · Grey wire = signal 0 · Toggle inputs to see live signal flow
Loading simulator…
📖 Simulator Quick Help
CIRCUIT DESIGNER TAB
1 Type a Boolean expression in the input box
2 Circuit diagram and truth table appear instantly
3 Toggle A, B, C inputs to see signals flow live
4 Current row is highlighted ◀ in the truth table
5 Tick "Auto-simplify" to convert NOT(AND)→NAND etc.
GATE TESTER TAB
1 Click any gate name: AND / OR / NOT / NAND / NOR
2 Toggle A and B inputs ON or OFF
3 See the live gate SVG symbol with coloured signals
4 Truth table highlights the current input state ◀
5 Rule summary and expression shown below the table
💾 Integrated Circuits & Practical Applications
How logic gates are packaged into ICs and used in real-world electronic systems.
🔷 What is an Integrated Circuit (IC)?
An Integrated Circuit (IC) is a miniaturised electronic circuit
containing transistors, resistors, capacitors, and diodes all on a single chip.
Complex devices like televisions and mobile phones contain many IC chips.
A microprocessor is made of a large number of ICs which use logic gates.
fact Modern CPUs contain billions of transistors on a single chip
fact Multiple complete circuits can be packed into one IC
fact Each IC is designed for a specific function
fact Logic gate ICs typically contain 4 identical gates per chip
COMMON LOGIC ICs (74-SERIES)
IC Number
Gate Type
Gates/chip
7408
AND (2-input)
4
7432
OR (2-input)
4
7404
NOT (Inverter)
6
7400
NAND (2-input)
4
7402
NOR (2-input)
4
A 14-pin AND gate IC (7408) has: input pins 1,2,4,5,9,10,12,13 · output pins 3,6,8,11 · power pins 7 (GND) and 14 (VCC)
🏠 Practical Example 1 — Home Alarm System
A home alarm system using OR gates protects two windows, a front door, and a back door.
When any window or door is opened, the alarm turns on.
1 Signal 1 = door/window OPEN (danger)
0 Signal 0 = door/window CLOSED (safe)
expr Alarm = W1 + W2 + FrontDoor + BackDoor
rule Alarm ON if ANY one sensor = 1 (OR logic)
rows 2⁴ = 16 possible states — alarm OFF only at (0,0,0,0)
Condition
Alarm
All = 0 (all closed)
0 — OFF
Any = 1 (any open)
1 — ON
💡 Practical Example 2 — Street Light Control System
A circuit using AND, OR, and NOT gates controls street lights using a light sensor, timer, and manual switch.
input Light sensor = 1 when bright → NOT gate inverts → 1 when dark
AND Timer AND Dark → AND gate → both must be true
OR ManualSwitch OR (Timer AND Dark) → final output
note Cloudy at 4 PM: dark=1 but timer=0 → light does NOT turn on
🚗 Practical Example 3 — Car Protection Circuit
A motor car manufacturing company designed a circuit to warn if there is movement in the car when the engine is not on,
or when there is damage to a shutter.
Uses three sensors (engine status, shutter damage, movement detector) connected through NOT, AND, and OR gates
to trigger a warning signal.
🧠 Quick Quiz — Test Your Knowledge
10 questions covering all logic gate topics. Click an answer to check it immediately.
Question 0 / 10 answered
Score: 0 / 10
📝 Practice Questions & Answers
Exam-style questions with step-by-step answers. Try each one before revealing the solution.
Q 01
Write the Boolean expression for an AND gate with inputs A and B. What is the output when A=1, B=0?
Boolean Expression: Q = A · B
A=1, B=0 → Q = 1 · 0 = 0
Q = 0
The AND gate requires ALL inputs to be 1. Since B=0, the output is 0.
Q 02
Draw the truth table for a NOR gate with two inputs A and B. How many rows does it have?
Rows = 2² = 4 (two inputs)
A=0, B=0 → A+B=0 → Q=(A+B)'=1
A=0, B=1 → A+B=1 → Q=(A+B)'=0
A=1, B=0 → A+B=1 → Q=(A+B)'=0
A=1, B=1 → A+B=1 → Q=(A+B)'=0
NOR output is 1 ONLY when ALL inputs = 0
Q 03
What is meant by a "Universal Gate"? Name the two universal gates.
A Universal Gate is a gate from which any other logic gate (AND, OR, NOT, etc.)
and any Boolean circuit can be constructed using only that single type of gate.
Universal Gates: NAND and NOR
Both NAND and NOR are called universal gates because all three basic gates (AND, OR, NOT)
can be built from either one of them alone.
Q 04
How many rows are in the truth table for a logic circuit with 4 inputs?
Formula: Rows = 2ⁿ, where n = number of inputs
n = 4 inputs
Rows = 2⁴ = 2 × 2 × 2 × 2
= 16 rows
Q 05
A home alarm system has 3 sensors: S1, S2, S3. The alarm sounds when any sensor is triggered. Write the Boolean expression and name the gate type used.
Since the alarm sounds when any sensor = 1, this is an OR condition.
Alarm = S1 + S2 + S3
Gate used: OR gate
The alarm is OFF only when ALL sensors = 0 (all clear). Truth table has 2³ = 8 rows.
Q 06
What is the output of a NOT gate when the input A = 1? What about when A = 0?
The NOT gate always inverts the input.
When A = 1 → Q = A' = 0
When A = 0 → Q = A' = 1
The NOT gate has only ONE input and its output is always the opposite (complement) of the input.
Q 07
Explain the difference between NAND and AND gates using their truth tables.
AND gate (Q = A·B): Output is 1 only when ALL inputs = 1.
0,0→0 | 0,1→0 | 1,0→0 | 1,1→1
NAND gate (Q = (A·B)'): Exact OPPOSITE of AND.
0,0→1 | 0,1→1 | 1,0→1 | 1,1→0
NAND output = 0 ONLY when ALL inputs = 1
NAND = AND + NOT: the output bubble (○) inverts the AND result.
Q 08
Design a logic circuit for the expression Q = A·B + C. Identify the gates required.
Expression: Q = A·B + C — 3 inputs, 8 truth table rows (2³)
Step 1: Gate 1 = AND gate → inputs: A and B → output: X = A·B
Step 2: Gate 2 = OR gate → inputs: X and C → output: Q = X+C = A·B+C
Gates needed: 1 AND gate + 1 OR gate
AND is evaluated before OR (operator precedence), so no brackets needed here.
💡 Study Tips
1
Memorise gate rules, not just tables. AND = "all must be 1", OR = "any one is enough", NOT = "always flips".
2
NAND and NOR are just reversed. NAND = opposite of AND. NOR = opposite of OR. If you know AND/OR, flip every output cell for NAND/NOR.
3
Count rows before drawing. Always calculate 2ⁿ first. More than 5 inputs = very large table; most exam questions use 2–4 inputs.
4
Draw the circuit left-to-right. Start with inputs on the left, work through NOT → AND → OR toward the output Q on the right.
5
Use the simulator. Type expressions like A.B + !C in the Circuit Designer tab to instantly see and interact with the circuit.